package UIUtils {
	public class uif_timeProfile {
		private static var _list: Object = {};
		
		public static const STARTSTATE: int = 1;
		public static const ENDSTATE: int = 2;
		
		public static function startSection(nameSection: String): void {
			var obj: Object = _list[nameSection]?_list[nameSection]:{deltaTime:0,count:0};
			
			obj.state		= STARTSTATE;
			obj.startTime	= (new Date()).time;
			
			_list[nameSection] = obj;
		}
		
		public static function endSection(nameSection: String): Object {
			var obj: Object;
			if (_list[nameSection]) {
				obj				= _list[nameSection];
				obj.state		= ENDSTATE;
				obj.endTime 	= (new Date()).time;
				obj.deltaTime 	= obj.deltaTime + (obj.endTime - obj.startTime);
				obj.count++;
			}
			return obj;
		}
		
		public static function clearSection(nameSection: String): void {
			if (_list[nameSection]) {
				var obj: Object	= _list[nameSection];
				obj.deltaTime 	= 0;
				obj.count		= 0;
			}
		}
		
		public static function getList(): Object {
			return uif_util.clone(_list);
		}
	}
}